/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

import java.io.Serializable;
import java.math.BigInteger;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author WinKiQue58
 */
@Entity
@Table(name = "CONSOLIDATED")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Consolidated.findAll", query = "SELECT c FROM Consolidated c"),
    @NamedQuery(name = "Consolidated.findByIdConsolidated", query = "SELECT c FROM Consolidated c WHERE c.consolidatedPK.idConsolidated = :idConsolidated"),
    @NamedQuery(name = "Consolidated.findByIdClosure", query = "SELECT c FROM Consolidated c WHERE c.consolidatedPK.idClosure = :idClosure"),
    @NamedQuery(name = "Consolidated.findByIdWarehouse", query = "SELECT c FROM Consolidated c WHERE c.consolidatedPK.idWarehouse = :idWarehouse"),
    @NamedQuery(name = "Consolidated.findByAmount", query = "SELECT c FROM Consolidated c WHERE c.amount = :amount"),
    @NamedQuery(name = "Consolidated.findBySold", query = "SELECT c FROM Consolidated c WHERE c.sold = :sold"),
    @NamedQuery(name = "Consolidated.findByPending", query = "SELECT c FROM Consolidated c WHERE c.pending = :pending"),
    @NamedQuery(name = "Consolidated.findByDevolution", query = "SELECT c FROM Consolidated c WHERE c.devolution = :devolution"),
    @NamedQuery(name = "Consolidated.findByOutofstock", query = "SELECT c FROM Consolidated c WHERE c.outofstock = :outofstock"),
    @NamedQuery(name = "Consolidated.findByObsolete", query = "SELECT c FROM Consolidated c WHERE c.obsolete = :obsolete"),
    @NamedQuery(name = "Consolidated.findByInmediatelysell", query = "SELECT c FROM Consolidated c WHERE c.inmediatelysell = :inmediatelysell")})
public class Consolidated implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ConsolidatedPK consolidatedPK;
    @Basic(optional = false)
    @NotNull
    @Column(name = "AMOUNT")
    private BigInteger amount;
    @Basic(optional = false)
    @NotNull
    @Column(name = "SOLD")
    private BigInteger sold;
    @Basic(optional = false)
    @NotNull
    @Column(name = "PENDING")
    private BigInteger pending;
    @Basic(optional = false)
    @NotNull
    @Column(name = "DEVOLUTION")
    private BigInteger devolution;
    @Basic(optional = false)
    @NotNull
    @Column(name = "OUTOFSTOCK")
    private BigInteger outofstock;
    @Basic(optional = false)
    @NotNull
    @Column(name = "OBSOLETE")
    private BigInteger obsolete;
    @Basic(optional = false)
    @NotNull
    @Column(name = "INMEDIATELYSELL")
    private BigInteger inmediatelysell;
    @JoinColumns({
        @JoinColumn(name = "PRODUCT_ID_PRODUCT", referencedColumnName = "ID_PRODUCT"),
        @JoinColumn(name = "PRODUCT_ID_BRANCHENTERPRISE", referencedColumnName = "ID_BRANCHENTERPRISE"),
        @JoinColumn(name = "PRODUCT_ID_ENTERPRISE", referencedColumnName = "ID_ENTERPRISE")})
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Product product;
    @JoinColumns({
        @JoinColumn(name = "ID_CLOSURE", referencedColumnName = "ID_CLOSURE", insertable = false, updatable = false),
        @JoinColumn(name = "ID_WAREHOUSE", referencedColumnName = "ID_WAREHOUSE", insertable = false, updatable = false)})
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Closure closure;

    public Consolidated() {
    }

    public Consolidated(ConsolidatedPK consolidatedPK) {
        this.consolidatedPK = consolidatedPK;
    }

    public Consolidated(ConsolidatedPK consolidatedPK, BigInteger amount, BigInteger sold, BigInteger pending, BigInteger devolution, BigInteger outofstock, BigInteger obsolete, BigInteger inmediatelysell) {
        this.consolidatedPK = consolidatedPK;
        this.amount = amount;
        this.sold = sold;
        this.pending = pending;
        this.devolution = devolution;
        this.outofstock = outofstock;
        this.obsolete = obsolete;
        this.inmediatelysell = inmediatelysell;
    }

    public Consolidated(BigInteger idConsolidated, BigInteger idClosure, BigInteger idWarehouse) {
        this.consolidatedPK = new ConsolidatedPK(idConsolidated, idClosure, idWarehouse);
    }

    public ConsolidatedPK getConsolidatedPK() {
        return consolidatedPK;
    }

    public void setConsolidatedPK(ConsolidatedPK consolidatedPK) {
        this.consolidatedPK = consolidatedPK;
    }

    public BigInteger getAmount() {
        return amount;
    }

    public void setAmount(BigInteger amount) {
        this.amount = amount;
    }

    public BigInteger getSold() {
        return sold;
    }

    public void setSold(BigInteger sold) {
        this.sold = sold;
    }

    public BigInteger getPending() {
        return pending;
    }

    public void setPending(BigInteger pending) {
        this.pending = pending;
    }

    public BigInteger getDevolution() {
        return devolution;
    }

    public void setDevolution(BigInteger devolution) {
        this.devolution = devolution;
    }

    public BigInteger getOutofstock() {
        return outofstock;
    }

    public void setOutofstock(BigInteger outofstock) {
        this.outofstock = outofstock;
    }

    public BigInteger getObsolete() {
        return obsolete;
    }

    public void setObsolete(BigInteger obsolete) {
        this.obsolete = obsolete;
    }

    public BigInteger getInmediatelysell() {
        return inmediatelysell;
    }

    public void setInmediatelysell(BigInteger inmediatelysell) {
        this.inmediatelysell = inmediatelysell;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public Closure getClosure() {
        return closure;
    }

    public void setClosure(Closure closure) {
        this.closure = closure;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (consolidatedPK != null ? consolidatedPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Consolidated)) {
            return false;
        }
        Consolidated other = (Consolidated) object;
        if ((this.consolidatedPK == null && other.consolidatedPK != null) || (this.consolidatedPK != null && !this.consolidatedPK.equals(other.consolidatedPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.Consolidated[ consolidatedPK=" + consolidatedPK + " ]";
    }
    
}
